// $Id: WorkflowPerspectiveListener.java 89 2012-03-31 10:43:58Z huijzer@gmail.com $
package lime;

import lime.common.LimeException;
import lime.workflow.WorkflowPerspective;

import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PerspectiveAdapter;

public class WorkflowPerspectiveListener extends PerspectiveAdapter {

	@Override
	public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {

		if (perspective.getId().equals(WorkflowPerspective.ID)) {

			IViewReference[] references = page.getViewReferences();
			for (IViewReference reference : references) {
				try {
					page.showView(reference.getId(), null, IWorkbenchPage.VIEW_CREATE);
				} catch (PartInitException e) {
					throw new LimeException(e);
				}
			}
		}

	}

}